<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterPage.master" CodeBehind="ByStyle.aspx.cs" Inherits="www.Search_ByStyle" %>

<%@ Register Assembly="NBusiness" Namespace="NBusiness.Data.Web" TagPrefix="cc1" %>

<asp:Content ID="Content1" runat="Server" ContentPlaceHolderID="contentPlaceHolder1">
    <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="StyleDataSource"
        DataTextField="Name" DataValueField="BeerStyleId" OnDataBound="DropDownList1_DataBound">
    </asp:DropDownList>
    <asp:Button ID="GoButton" runat="server" OnClick="GoButton_Click" Text="Go" />
    <cc1:entitydatasource id="StyleDataSource" runat="server" 
        assemblyname="Example.Entities, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"
        onselect="StyleDataSource_Select" typename="BeerBase.Business.CachedBeerStyleCollection">
    </cc1:entitydatasource>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="BeerId"
        DataSourceID="BeerDataSource" OnRowDataBound="GridView1_RowDataBound" EmptyDataText="No Beers found in this style" AllowPaging="True" AllowSorting="True" PageSize="5">
        <Columns>
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
            <asp:TemplateField HeaderText="Brewing Company" SortExpression="CompanyId">
                <ItemTemplate>
                    <asp:HyperLink ID="CompanyLink" runat="server" NavigateUrl='<%# Eval("CompanyId", "~/Company.aspx?c={0}") %>'></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Alcohol" HeaderText="Alcohol" SortExpression="Alcohol" DataFormatString="{0:p}" />
            <asp:TemplateField HeaderText="Availability" SortExpression="AvailabilityId">
                <ItemTemplate>
                    <asp:HyperLink ID="AvailabilityLink" runat="server" NavigateUrl='<%# Eval("AvailabilityId", "~/Search/ByAvailability.aspx?a={0}") %>'></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <cc1:entitydatasource id="BeerDataSource" runat="server" 
        assemblyname="Example.Entities, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"
        typename="BeerBase.Business.BeerCollection" 
        OnSelect="BeerDataSource_Select">
    </cc1:entitydatasource>
</asp:Content>